#include "ffile.hpp"

auto Ffile::open(const char * fileName,unsigned int _mode) -> bool
{
    //如果file流已经打开，则直接关闭这个流在重新打开文件
    if(file.is_open()) this->close();
    file.open(fileName,_mode);
    return file.is_open() ? true : false;
}

auto Ffile::close() -> void 
{
    file.close();
}

auto Ffile::read_word() -> std::string
{
    std::string str;
    this->file >> str;
    return str;
}

auto Ffile::read_line() -> std::string
{
    std::string str;
    getline(file,str);
    return str;
}